Skip to content

Add hard-link support to PathRoot - #43

Merged
agocke merged 2 commits into
mainfrom
feature/path-root-hard-links
Sep 19, 2026
Merged

agocke merged 2 commits into
mainfrom
feature/path-root-hard-links

Conversation

@agocke

@agocke agocke commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • add PathRoot.CreateHardLink(path, pathToTarget) using .NET argument ordering without returning an ambient FileSystemInfo
  • create hard links relative to retained directory handles with linkat on Linux/macOS and NtSetInformationFile(FileLinkInformation) on Windows
  • confine both the destination and target paths against .. and intermediate symbolic-link traversal
  • preserve native/.NET behavior by hard-linking a final symbolic link itself rather than traversing its target
  • document the API and add coverage for sharing, one-character names, existing destinations, missing or directory targets, and escape attempts

Testing

  • dotnet csharpier check .
  • dotnet test static-cs.sln --no-restore --nologo — 140 passed, 1 skipped
  • cross-published StaticCs.PathRoot for linux-x64 and win-x64

Add a confined CreateHardLink API with handle-relative Unix and Windows implementations. Preserve native hard-link semantics for symbolic-link targets and cover traversal, overwrite, sharing, and ABI edge cases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 59a89ad1-3cb4-4b25-b561-fb5f5da7ffba
Prepare the hard-link API update for publishing after version 0.1.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 59a89ad1-3cb4-4b25-b561-fb5f5da7ffba
@agocke
agocke merged commit 00ce62c into main Sep 19, 2026
2 checks passed
@agocke
agocke deleted the feature/path-root-hard-links branch September 19, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant